import random
x = random.randint(1,1000)


def qsort(list, start, end):
    if end - start < 2:
        return
    left = start
    right = end - 1
    sentry = list[left]
    while left != right:
        while left != right and list[right] >= sentry:
            right -= 1
        list[left] = list[right]
        while left != right and list[left] <= sentry:
            left += 1
        list[right] = list[left]

    list[left] = sentry
    qsort(list,start,left)
    qsort(list,left+1,end)        


if __name__ == '__main__':
    x = [random.randint(1,30) for i in range(30)]
    print(x)
    qsort(x,0,len(x))
    print(x)
    pass